﻿using System.Web.Mvc;
using YBBEST.Office365Portal.Core;
using YBBEST.Office365Portal.MvcWebRole.Models;

namespace YBBEST.Office365Portal.MvcWebRole.Controllers
{
    public class SiteController : Controller
    {
        private readonly IMeetingRepository meetingRepository;

        public SiteController(IMeetingRepository meetingRepository)
        {
            this.meetingRepository = meetingRepository;
        }

        public ActionResult Index()
        {
            return View(new MeetingModel());
        }

        [HttpPost]
        public ActionResult Create(MeetingModel meetingModel)
        {
            meetingRepository.CreateNewSite(meetingModel.SiteName,meetingModel.TemplateCode);
            return RedirectToAction("Index", "Home");
        }
    }
}